<!DOCTYPE html>
<html><head>
<title>HTML KickStart</title>
<meta charset="UTF-8">
<meta name="description" content="" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<script type="text/javascript" src="js/prettify.js"></script>                                   <!-- PRETTIFY -->
<script type="text/javascript" src="js/kickstart.js"></script>                                  <!-- KICKSTART -->
<link rel="stylesheet" type="text/css" href="css/kickstart.css" media="all" />                  <!-- KICKSTART -->
<link rel="stylesheet" type="text/css" href="style.css" media="all" />                          <!-- CUSTOM STYLES -->
</head><body><a id="top-of-page"></a><div id="wrap" class="clearfix">
<!-- ===================================== END HEADER ===================================== -->


	
	<div class="col_12">
		
		<h1>Новости: админка</h1>

		<!-- Menu Horizontal -->
		<ul class="menu">
			
				<li <?php 
					   if ($_GET['id'] == null) 
							{ ?>  
							 class="current" 
					  <?php }?> 
					>
					<a href="admin.php">Главная
					</a>
				</li>
			
			<?php 	
			If ($menu != null)
			{
				foreach ($menu as $line) 
					{	?>
						<li <?php 
								  if ($_GET['id'] == $line['id']) 
									{ ?> 
									   class="current" 
							  <?php }  ?> >
							<a href="?id=<?php echo $line['id']; ?>">
								<?php echo $line['title'] ?>
							</a>
						</li>
			 <?php  } 
			}?>
		</ul>


	</div>

	<div class="col_12">

		<!--<div>
		<ul class="button-bar">
		<li> 
				 <a href="<?php if ($_GET['id']) {echo "grabber.php?id={$_GET['id']}";} else echo "grabber.php";?>">получить свежие новости</a>
			</li> 
		</ul> -->
	<form method="post" action="<?php if ($_GET['id']) {echo "grabber.php?id={$_GET['id']}";} else echo "grabber.php"; ?>">
	<button class="medium" type="submit"name="kk" >получить свежие новости</button>
	<form>
	<label>Последнее обновление: </label><label> <?php echo " {$result[1]['added_date']}          "; ?></label>
     
	<button class="medium" type="submit" formaction="index.php" >Выход</button>
	</div>

	<form method="post" action="admin.php<?php echo $v; ?>">
	<table  class="striped">
	<thead><tr>
		<th>Дата</th>
		<th>Новость</th>
		<th>Активна</th>
	</tr></thead>
	<tbody>
	
		<?php 			
    $res=$result;		
	 If ($res != null)
	    {$i=0;
		
		   foreach ($res as $line)
			    {  
				?>
				    <tr>
					   <td><?php echo $line['added_date']; ?></td>
					   <td><?php echo $line['title'];?></td>
					   <td><input type="checkbox" name=ss<?php echo $i; ?> value="
					    <?php 
					      echo $line['id']; 
						 ?>" 
						    <?php 
						       if ($line['see'] ==1) echo "checked"; 
						    ?>></td>
					   
				    </tr>

	   
		  <?php $i++; }	  
		  
		} else  { ?>
		         <tr><h4>Новостей нет.<h4></tr>
		  <?php } ?>
		 	
	
	</form>
	</tbody>
	</table>
	<input type=hidden name=massiv_stroka value=<?php $test=$ss; $massiv_stroka=serialize($test); echo $massiv_stroka; ?> >
	<div><button class="medium" type="submit"name="kk" >Сохранить</button></div>
	</form>
	
  	</div>

	<!-- ===================================== pages ===================================== -->
	<div  class="col_12"?>
				<ul class="button-bar">
						
					<?php  $PagesOnSite=30;  
						  if ($from >=$PagesOnSite) 
						    { ?> 	
							  <li><a href="<?php echo"admin.php$v";?>page=<?php echo $from-1;?>">prev <?php echo $PagesOnSite; ?> ...</a></li> 
					  <?php } ?>
					 
					 <?php  for($i=$from; $i<=$to; $i++)
						{ ?>
							<li <?php if($_GET['page'] == $i) 
									   { ?> class="current-bar" 
								 <?php } else if ($i==1 && $_GET['page'] == null ) 
												{?> class="current-bar" <?php }  ?>>
												<a href="<?php echo "admin.php?$v";?>page=<?php echo $i;?>"><?php echo $i;?></a></li>
				  <?php } ?>
					 <?php  if ($to < $stranic) 
						        { ?> 	
								  <li><a href="<?php echo "admin.php?$v";?>page=<?php echo $i;?>">next <?php echo $PagesOnSite; ?> ...</a></li> 
						  <?php } ?>
				</ul>
			</div>
  <?php   ?>
<!-- ===================================== START FOOTER ===================================== -->
</div>

</div><!-- END WRAP -->
</body></html>